package com.pd.controller.admin;

import com.pd.kit.JsonKit;
import com.pd.pojo.ResponseVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * Created by dong peng on 2017/6/11.
 */
@Controller
@RequestMapping("/admin/abtype")
public class AccountBookTypeCtl extends ManageBaseController{

    /**
     *查询用户
     */
    @RequestMapping(value = "/query")
    public @ResponseBody
    String query(HttpServletRequest req, HttpServletResponse resp){

        Map map = getPara(req);
        ResponseVo responseVo = accountBookTypeService.query(map);

        return JsonKit.toJson(responseVo);
//        return "/index.html";
    }

    /**
     *
     * 新增用户
     */
    @RequestMapping(value = "/add")
    public @ResponseBody String add(HttpServletRequest req, HttpServletResponse resp) {
        Map param = getPara(req);
        ResponseVo responseVo = accountBookTypeService.add(param);

        return JsonKit.toJson(responseVo);
    }

    /**
     *
     * 修改用户
     */
    @RequestMapping(value = "/modify")
    public @ResponseBody String modify(HttpServletRequest req, HttpServletResponse resp) {
        Map param = getPara(req);
        ResponseVo responseVo = accountBookTypeService.modify(param);

        return JsonKit.toJson(responseVo);
    }

    /**
     *
     * 删除用户
     */
    @RequestMapping(value = "/delete")
    public @ResponseBody String delete(HttpServletRequest req, HttpServletResponse resp) {
        Map param = getPara(req);
        ResponseVo responseVo = accountBookTypeService.delete(param);

        return JsonKit.toJson(responseVo);
    }

}
